import { defHttp } from "@/utils/http";

// ERP 销售明细 VO
export interface SlDtlVO {
	groupId: number; // 主键,示例值(16472)
	type: number; //类型,示例值(2)
	whsId: number; // 仓库代码,示例值(8417)
	deptId: string; // 部门代码,示例值(9671)
	userId: number; // 用户ID
}

// ERP 销售明细 API
export const SlDtlApi = {
	// 查询销售明细分页
	getSlDtlPage: async (params: any) => {
		return await defHttp.get({ url: `/whs/detail-record/page`, params });
	},

	// 查询销售明细详情
	getSlDtl: async (id: number) => {
		return await defHttp.get({ url: `/whs/detail-record/get?id=` + id });
	},

	// 新增销售明细
	createSlDtl: async (data: SlDtlVO) => {
		return await defHttp.post({ url: `/whs/detail-record/create`, data });
	},

	// 修改销售明细
	updateSlDtl: async (data: SlDtlVO) => {
		return await defHttp.put({ url: `/whs/detail-record/update`, data });
	},

	// 删除销售明细
	deleteSlDtl: async (id: number) => {
		return await defHttp.delete({
			url: `/whs/detail-record/delete?id=` + id
		});
	},

	// 导出销售明细 Excel
	exportSlDtl: async (params: any) => {
		return await defHttp.download({ url: `/whs/detail-record/export-excel`, params });
	}
};
